/**
 * 标签选择器
 * @param element  #id .class
 * @returns {Promise<unknown>}
 */
function select (element) {
  return new Promise((resolve) => {
    let query = mpvue.createSelectorQuery()
    query.select(element).boundingClientRect()
    query.exec(function (res) {
      resolve(res)
    })
  })
}

/**
 * 选择所有标签选择器
 * @param element
 * @returns {Promise<unknown>}
 */
function selectAll (element) {
  return new Promise((resolve) => {
    let query = mpvue.createSelectorQuery()
    query.selectAll(element).boundingClientRect()
    query.exec(function (res) {
      resolve(res)
    })
  })
}

export {
  select,
  selectAll
}
